package com.cairenhui.trust.auto.task.model;

import java.util.List;

public class Page<T> {

	//开始位置
	private Integer begin;
	//结束位置
	private Integer end;
	//显示页数
	private Integer pageSize = 15;
	//总条数
	private Integer totalCount;
	//分页数目
	private Integer totalPage;
	//返回结果集合
	List<T> resultList;
	
	//public Page(){}
	
	private Page(Integer begin,Integer pageSize){
		if(begin==0){
			begin = 1;
		}
		this.begin = (begin-1)*pageSize +1;
		this.pageSize = pageSize;
		this.end = begin * pageSize;
	}
	
	public Page(Integer begin,Integer pageSize,Integer totalCount){
		this(begin,pageSize);
		this.totalCount = totalCount;
		if(totalCount % pageSize == 0){
			this.totalPage = totalCount / pageSize;
		}else{
			this.totalPage = totalCount / pageSize + 1;
		}
	}

	public Integer getBegin() {
		return begin;
	}

	public void setBegin(Integer begin) {
		this.begin = begin;
	}

	public Integer getEnd() {
		return end;
	}

	public void setEnd(Integer end) {
		this.end = end;
	}

	public Integer getPageSize() {
		return pageSize;
	}

	public void setPageSize(Integer pageSize) {
		this.pageSize = pageSize;
	}

	public Integer getTotalCount() {
		return totalCount;
	}

	public void setTotalCount(Integer totalCount) {
		this.totalCount = totalCount;
	}

	public Integer getTotalPage() {
		return totalPage;
	}

	public void setTotalPage(Integer totalPage) {
		this.totalPage = totalPage;
	}

	public List<T> getResultList() {
		return resultList;
	}

	public void setResultList(List<T> resultList) {
		this.resultList = resultList;
	}
	
	
	
	/*public static void main(String[] args) {
		int show = 15;
		for(int i=0;i<4;i++){
			Page p = new Page(i,show);
			System.out.println("第"+i+"页<>开始"+p.getbegin()+"结束"+p.getend());
		}
		
		
	}
	*/
}
